using System;
using System.ServiceModel;

namespace Caramel.ServiceModel
{
	public class PerCallLocalStorage : ILocalStorage
	{
		public object this[object key]
		{
			get
			{
				return
					OperationContext.
						Current.
						Extensions.
						Find<PerCallLocalStorageExtension>().
						Items[key];
			}
			set
			{
				OperationContext.				
					Current.
					Extensions.
					Find<PerCallLocalStorageExtension>().
					Items[key] = value;
			}
		}

		public void Clear()
		{
			OperationContext.
				Current.
				Extensions.
				Find<PerCallLocalStorageExtension>().
				Items.
				Clear();
		}

		public void Add(object key, object value)
		{
			OperationContext.
				Current.
				Extensions.
				Find<PerCallLocalStorageExtension>().
				Items.
				Add(key, value);
		}

		public bool Contains(object key)
		{
			return
				OperationContext.
					Current.
					Extensions.
					Find<PerCallLocalStorageExtension>().
					Items.
					Contains(key);
		}

		public System.Collections.IDictionaryEnumerator GetEnumerator()
		{
			throw new NotImplementedException();
		}

		public bool IsFixedSize
		{
			get { throw new NotImplementedException(); }
		}

		public bool IsReadOnly
		{
			get { throw new NotImplementedException(); }
		}

		public System.Collections.ICollection Keys
		{
			get { throw new NotImplementedException(); }
		}

		public void Remove(object key)
		{
			throw new NotImplementedException();
		}

		public System.Collections.ICollection Values
		{
			get { throw new NotImplementedException(); }
		}

		public void CopyTo(Array array, int index)
		{
			throw new NotImplementedException();
		}

		public int Count
		{
			get { throw new NotImplementedException(); }
		}

		public bool IsSynchronized
		{
			get { throw new NotImplementedException(); }
		}

		public object SyncRoot
		{
			get { throw new NotImplementedException(); }
		}

		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			throw new NotImplementedException();
		}
	}
}
